#ifndef THREAD_H
#define THREAD_H

#include <vector>
#include <thread>
#include <iostream>
#include "TaskQueue.h"

using std::cout;
using std::endl;
using std::thread;
using std::vector;

class ThreadPool
{
private:
    size_t _poolSize;
    vector<thread> _threads;
    size_t _taskSize;
    TaskQueue _tasks;

private:
    void init();

public:
    ThreadPool(size_t poolSize = 100, size_t taskSize = 1000);
    ~ThreadPool();
    std::unique_ptr<Task> processTask();
    void addTask(Task *);

    static void threadFunc(void *);
};
#endif